/*
   @Copyright:LibreOJ
   @Author:   tjyemail
   @Problem:  https://loj.ac/problem/103
   @Language: C++
   @Datetime: 20-08-03 17:07
   */
// kmp+opt, time 40ms
#include <bits/stdc++.h>
using namespace std;

char A[1000005], B[1000005];
int NEXT[1000005];
inline int find(int j, char ch) {
	for(; j; j=NEXT[j])
		if (B[j] == ch) return j+1;
	return B[0]==ch;
}

int main()
{
	//scanf("%s %s", A, B);
	gets(A), gets(B);
	int la = strlen(A), lb = strlen(B), n=0;
	for(int j=1; j++<lb; NEXT[j]=find(NEXT[j-1], B[j-1]));
	for(int i=0, j=0; i<la; ++i) {
		j = find(j, A[i]);
		if(j == lb) ++n; // found A[i-lb+1, i]
	}
	printf("%d\n", n);
	return 0;
}
